<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HexFiend: HFFileReference Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">HexFiend
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Instance Methods</a> &#124;
<a href="#properties">Properties</a> &#124;
<a href="interface_h_f_file_reference-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">HFFileReference Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A reference to an open file.  
 <a href="interface_h_f_file_reference.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for HFFileReference:</div>
<div class="dyncontent">
 <div class="center">
  <img src="interface_h_f_file_reference.png" usemap="#HFFileReference_map" alt=""/>
  <map id="HFFileReference_map" name="HFFileReference_map">
<area href="interface_h_f_concrete_file_reference.html" title="A reference to an open file that can be read (and possibly written) using normal C functions..." alt="HFConcreteFileReference" shape="rect" coords="0,112,161,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Instance Methods</h2></td></tr>
<tr class="memitem:a18fc517a2d1db86f69504b3d2b13ebe1"><td class="memItemLeft" align="right" valign="top">(instancetype)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#a18fc517a2d1db86f69504b3d2b13ebe1">initWritableWithPath:error:</a></td></tr>
<tr class="separator:a18fc517a2d1db86f69504b3d2b13ebe1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a125eec19204e5fb457f312450978a233"><td class="memItemLeft" align="right" valign="top">(instancetype)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#a125eec19204e5fb457f312450978a233">initWithPath:error:</a></td></tr>
<tr class="separator:a125eec19204e5fb457f312450978a233"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ed63c568c05f301fcd4b56056eaa779"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#a3ed63c568c05f301fcd4b56056eaa779">close</a></td></tr>
<tr class="separator:a3ed63c568c05f301fcd4b56056eaa779"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a99d57d3f3eaa0fef37952db64219b989"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#a99d57d3f3eaa0fef37952db64219b989">readBytes:length:from:</a></td></tr>
<tr class="separator:a99d57d3f3eaa0fef37952db64219b989"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab337821f71ce9780c61d38593ecec358"><td class="memItemLeft" align="right" valign="top">(int)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#ab337821f71ce9780c61d38593ecec358">writeBytes:length:to:</a></td></tr>
<tr class="separator:ab337821f71ce9780c61d38593ecec358"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3e560b662a0fa7437d6d4c3e3f58c86"><td class="memItemLeft" align="right" valign="top">(unsigned long long)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#ad3e560b662a0fa7437d6d4c3e3f58c86">length</a></td></tr>
<tr class="separator:ad3e560b662a0fa7437d6d4c3e3f58c86"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab8e6713bf53af17ba1f53202b1287978"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#ab8e6713bf53af17ba1f53202b1287978">setLength:error:</a></td></tr>
<tr class="separator:ab8e6713bf53af17ba1f53202b1287978"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2e13d8bd4cdf513b16b3667c2d21ba8a"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interface_h_f_file_reference.html#a2e13d8bd4cdf513b16b3667c2d21ba8a">isEqual:</a></td></tr>
<tr class="separator:a2e13d8bd4cdf513b16b3667c2d21ba8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:a5920cc8cc72ffeeb64d1392af4b35eea"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_h_f_file_reference.html#a5920cc8cc72ffeeb64d1392af4b35eea">isPrivileged</a></td></tr>
<tr class="separator:a5920cc8cc72ffeeb64d1392af4b35eea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96407283d05981a38b695a188872f619"><td class="memItemLeft" align="right" valign="top">BOOL&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_h_f_file_reference.html#a96407283d05981a38b695a188872f619">isFixedLength</a></td></tr>
<tr class="separator:a96407283d05981a38b695a188872f619"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="interface_h_f_file_reference.html" title="A reference to an open file. ">HFFileReference</a> encapsulates a reference to an open file. Multiple instances of <a class="el" href="interface_h_f_file_byte_slice.html" title="A subclass of HFByteSlice for working data stored in files. ">HFFileByteSlice</a> may share an <a class="el" href="interface_h_f_file_reference.html" title="A reference to an open file. ">HFFileReference</a>, so that the file only needs to be opened once.</p>
<p><a class="el" href="interface_h_f_file_reference.html" title="A reference to an open file. ">HFFileReference</a> is an abstract class. You must instantiate <a class="el" href="interface_h_f_concrete_file_reference.html" title="A reference to an open file that can be read (and possibly written) using normal C functions...">HFConcreteFileReference</a>.</p>
<p>All HFFileReferences use non-caching IO (F_NOCACHE is set). </p>
</div><h2 class="groupheader">Method Documentation</h2>
<a id="a18fc517a2d1db86f69504b3d2b13ebe1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a18fc517a2d1db86f69504b3d2b13ebe1">&sect;&nbsp;</a></span>initWritableWithPath:error:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (instancetype) initWritableWithPath: </td>
          <td></td>
          <td class="paramtype">(NSString *)&#160;</td>
          <td class="paramname"><em>path</em></td>
        </tr>
        <tr>
          <td class="paramkey">error:</td>
          <td></td>
          <td class="paramtype">(NSError **)&#160;</td>
          <td class="paramname"><em>error</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Open a file for reading and writing at the given path. The permissions mode of any newly created file is 0644. Returns nil if the file could not be opened, in which case the error parameter (if not nil) will be set. </p>

</div>
</div>
<a id="a125eec19204e5fb457f312450978a233"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a125eec19204e5fb457f312450978a233">&sect;&nbsp;</a></span>initWithPath:error:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (instancetype) initWithPath: </td>
          <td></td>
          <td class="paramtype">(NSString *)&#160;</td>
          <td class="paramname"><em>path</em></td>
        </tr>
        <tr>
          <td class="paramkey">error:</td>
          <td></td>
          <td class="paramtype">(NSError **)&#160;</td>
          <td class="paramname"><em>error</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Open a file for reading only at the given path. Returns nil if the file could not be opened, in which case the error parameter (if not nil) will be set. </p>

</div>
</div>
<a id="a3ed63c568c05f301fcd4b56056eaa779"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3ed63c568c05f301fcd4b56056eaa779">&sect;&nbsp;</a></span>close()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) close </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Closes the file. </p>

</div>
</div>
<a id="a99d57d3f3eaa0fef37952db64219b989"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99d57d3f3eaa0fef37952db64219b989">&sect;&nbsp;</a></span>readBytes:length:from:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (void) readBytes: </td>
          <td></td>
          <td class="paramtype">(unsigned char *)&#160;</td>
          <td class="paramname"><em>buff</em></td>
        </tr>
        <tr>
          <td class="paramkey">length:</td>
          <td></td>
          <td class="paramtype">(NSUInteger)&#160;</td>
          <td class="paramname"><em>length</em></td>
        </tr>
        <tr>
          <td class="paramkey">from:</td>
          <td></td>
          <td class="paramtype">(unsigned long long)&#160;</td>
          <td class="paramname"><em>offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Reads from the file into a local memory buffer. The sum of the length and the offset must not exceed the length of the file. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buff</td><td>The buffer to read into. </td></tr>
    <tr><td class="paramname">length</td><td>The number of bytes to read. </td></tr>
    <tr><td class="paramname">offset</td><td>The offset in the file to read. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ab337821f71ce9780c61d38593ecec358"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab337821f71ce9780c61d38593ecec358">&sect;&nbsp;</a></span>writeBytes:length:to:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (int) writeBytes: </td>
          <td></td>
          <td class="paramtype">(const unsigned char *)&#160;</td>
          <td class="paramname"><em>buff</em></td>
        </tr>
        <tr>
          <td class="paramkey">length:</td>
          <td></td>
          <td class="paramtype">(NSUInteger)&#160;</td>
          <td class="paramname"><em>length</em></td>
        </tr>
        <tr>
          <td class="paramkey">to:</td>
          <td></td>
          <td class="paramtype">(unsigned long long)&#160;</td>
          <td class="paramname"><em>offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Writes data to the file, which must have been opened writable. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buff</td><td>The data to write. </td></tr>
    <tr><td class="paramname">length</td><td>The number of bytes to write. </td></tr>
    <tr><td class="paramname">offset</td><td>The offset in the file to write to. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, or an errno-style error code on failure </dd></dl>

</div>
</div>
<a id="ad3e560b662a0fa7437d6d4c3e3f58c86"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad3e560b662a0fa7437d6d4c3e3f58c86">&sect;&nbsp;</a></span>length()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (unsigned long long) length </td>
          <td></td>
          <td class="paramname"></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the length of the file, as a 64 bit unsigned long long. </p>

</div>
</div>
<a id="ab8e6713bf53af17ba1f53202b1287978"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab8e6713bf53af17ba1f53202b1287978">&sect;&nbsp;</a></span>setLength:error:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (BOOL) setLength: </td>
          <td></td>
          <td class="paramtype">(unsigned long long)&#160;</td>
          <td class="paramname"><em>length</em></td>
        </tr>
        <tr>
          <td class="paramkey">error:</td>
          <td></td>
          <td class="paramtype">(NSError **)&#160;</td>
          <td class="paramname"><em>error</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Changes the length of the file via <code>ftruncate</code>. Returns YES on success, NO on failure; on failure it optionally returns an NSError by reference. </p>

</div>
</div>
<a id="a2e13d8bd4cdf513b16b3667c2d21ba8a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2e13d8bd4cdf513b16b3667c2d21ba8a">&sect;&nbsp;</a></span>isEqual:()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">- (BOOL) isEqual: </td>
          <td></td>
          <td class="paramtype">(id)&#160;</td>
          <td class="paramname"><em>val</em></td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>isEqual: returns whether two file references both reference the same file, as in have the same inode and device. </p>

</div>
</div>
<h2 class="groupheader">Property Documentation</h2>
<a id="a5920cc8cc72ffeeb64d1392af4b35eea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5920cc8cc72ffeeb64d1392af4b35eea">&sect;&nbsp;</a></span>isPrivileged</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">- (BOOL) isPrivileged</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">read</span><span class="mlabel">atomic</span><span class="mlabel">assign</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a96407283d05981a38b695a188872f619"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a96407283d05981a38b695a188872f619">&sect;&nbsp;</a></span>isFixedLength</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">- (BOOL) isFixedLength</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">read</span><span class="mlabel">atomic</span><span class="mlabel">assign</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="_h_f_file_reference_8h_source.html">HFFileReference.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
</body>
</html>
